﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
using WeChatIdentity.Constants;
using WeChatIdentity.Models;

namespace WeChatIdentity.EntityConfigurations
{
    public class UserClaimEntityTypeConfiguration
        : IEntityTypeConfiguration<UserClaim>
    {
        public void Configure(EntityTypeBuilder<UserClaim> builder)
        {

            builder.ToTable("UserClaim", SchemaConstants.SchemaName);

            builder.HasKey(ci => ci.Id);

            builder.Property(ci => ci.Id)
               .UseHiLo("UserClaimseq", SchemaConstants.SchemaName)
               .IsRequired();

            builder.Property(cb => cb.UserId)
               .IsRequired(true);
            builder.Property(cb => cb.ClaimType)
               .IsRequired(true);
            builder.Property(cb => cb.ClaimValue)
               .IsRequired(true);

        }
    }
}
